package user

import (
	"common/mildware"
	"common/models"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

func (h UHandler) GetUserInfo(c *gin.Context) {
	resp := new(models.RespData)
	//token获得Id
	ID, _, _, err := mildware.GetCyrrentUserID(c)
	if err != nil {
		zap.L().Error("User:GetUserInfo mildware.GetCyrrentUserID ", zap.Error(err))
		resp.SendCode(c, models.CodeInvalidParam)
		return
	}
	userInfo, err := h.M.QueryUserInfoByID(ID)
	if err != nil {
		zap.L().Error("User:GetUserInfo h.M.QueryUserInfoByID ", zap.Error(err))
		resp.SendServerBusy(c)
		return
	}
	resp.Data = userInfo
	resp.SendSuccess(c)
}
